<include file="__THEME__/header" />
<link  href="../Public/group.css" rel="stylesheet" type="text/css"/>
<!-- 微博 -->
<script type="text/javascript" src="__PUBLIC__/js/jquery.form.js"></script>
<script type="text/javascript" src="{:U('group/WeiboPlugins/init')}"></script>
<script type="text/javascript" src="__PUBLIC__/js/jquery.autocomplete.js"></script>
<script>
var gid = '<?php echo $gid; ?>';
<if condition="$ismember">
$(document).ready(function(){
    weibo.init();
	var url = "{:U('home/User/searchTips')}";
	userAutoTips({id:'content_publish', url:url});
});
</if>
</script> 
<include file="../Public/_mainNav" />
<div class="content"><!-- 内容 begin  -->  
  <div class="main no_l">
    <!-- 右侧内容 begin  -->
    <div class="mainbox"> 
      <include file="../Public/_groupInfo" />
      <div class="mainbox_C">
  <!--  简单头部 -->
  <include file="../Public/top" />
  <!--  简单头部结束  --> 
  <div class="groupBox">
      <div style="overflow:hidden;">
        <if condition="ACTION_NAME == 'search'">
          <div class="pt10">   
          <div class="Search_bg">
            <div>
            <form action="{:U('group/Group/search', array('gid'=>$groupinfo['id']))}" method="post">
                <input type="text" name="k"  value="{$search_key}" class="text" style="width:300px" /> <input type="submit" value="搜群聊" class="btn_b" />
            </form>	
            </div>
            </div>
            <php>if (empty($search_key)) {</php>
                  请输入关键字后点击搜索
            <php>} else {</php>
              <div class="cGray2 clearL lh30">找到 <span class="cRed">{$search_key}</span> 相关结果约：({$list.count})条</div>
            <php>}</php>
 
          </div>
        <else />
        	<if condition="$ismember">
            <div class="talkBox">
              <form method="post" action="{:U('group/WeiboOperate/publish')}" id="miniblog_publish" oncomplete="false">
                <input type="hidden" name="publish_type" value="0">
                <h2>
                  <div class="wordNum">你还可以输入<strong id="strconunt">140</strong>字</div>
                  <span>快来说点什么吧……</span></h2>
                <div class="cntBox">
                  <textarea name="content" id="content_publish" cols="" rows=""style="width:99.3%;_width:99%; height:78px;padding:5px 0;"
                  ><if condition="$search_key">#{$search_key}#</if></textarea>
                  <div class="txtShadow" style="z-index:-1000"></div>
                </div>
                <div class="funBox">
                  <div class="right" style="padding-bottom:5px;"> <label><input name="myweibo" type="checkbox" value="1" />同时发到我的微博</label>
                    <input type="hidden" name="gid" value="{$gid}">
                    <input type="button" disabled="true" onclick="weibo.do_publish()" class="btn_big_disable hand" value="&nbsp;" id="publish_handle"  />
                  </div>
                  <div id="publish_type_content_before" class="left">  </div>
                </div>
              </form>
            </div>        
            <else />
              <div class="talkBox" style="background-image:none; padding:0; height:auto;">
              <h2>
                  <div class="wordNum">你还可以输入<strong id="strconunt">140</strong>字</div>
                <span>快来说点什么吧……</span>
              </h2>
              <div class="cntBox alC" style="background-color:#F8F8F8; border:1px solid #EBEBEB; -moz-border-radius: 3px;-khtml-border-radius: 3px;-webkit-border-radius: 3px;border-radius: 3px; padding:30px 0; color:#666666">开始发言吧..<a href="javascript:joingroup({$gid});">加入群</a></div>
              </div>
            </if>
        </if>
        <switch name="ACTION_NAME">
          <case value="index">
            <div class="tab-menu" style="display:none"><!-- 切换标签 begin  --> 
              <!--
            <div onmouseout="this.className='feeds_sift'" onmouseover="this.className='feeds_sift_hover'" class="feeds_sift"><a class="ico" href="#">&nbsp;</a>
              <div class="feeds_sift_box">
                <p>类型筛选</p> 
                <a appid="" href="javascript:void(0)">全部</a> </div>
            </div>
        -->
              <ul>
                <li><a id="feed_colleague_item" rel="colleague" class="<eq name='type' value=''>on</eq> feed_item" href="{:U('home/user/index')}"><span>全部</span></a></li>
                <php>if($show_feed==0){</php>
                <li><a id="feed_all_item" rel="all" class="<eq name='type' value='original'>on</eq> feed_item" href="{:U('/Group/',array('gid'=>$gid,'type'=>'original'))}"><span>原创</span></a></li>
                <li><a id="feed_all_item" rel="all" class="<eq name='type' value='1'>on</eq> feed_item" href="{:U('/Group/',array('gid'=>$gid,'type'=>'1'))}"><span>图片</span></a></li>
                <li><a id="feed_all_item" rel="all" class="<eq name='type' value='3'>on</eq> feed_item" href="{:U('/Group/',array('gid'=>$gid,'type'=>'3'))}"><span>视频</span></a></li>
                <li><a id="feed_all_item" rel="all" class="<eq name='type' value='4'>on</eq> feed_item" href="{:U('/Group/',array('gid'=>$gid,'type'=>'4'))}"><span>音乐</span></a></li>
                <php>}</php>
              </ul>
            </div>
          </case>
          <case value="atme">
            <div class="tab-menu">
              <ul>
                <li><a href="#" class="on feed_item"><span>提到我的</span></a></li>
              </ul>
            </div>
          </case>
          <case value="collection">
            <div class="tab-menu">
              <ul>
                <li><a href="#" class="on feed_item"><span>我收藏的</span></a></li>
              </ul>
            </div>
          </case>
        </switch>
        <div class="feedBox">
          <div id="countNew"> </div>
          <ul class="feed_list" id="feed_list">
          <php>if ($list['data']) {</php> 
            <volist id="vo" name="list['data']">
<php>if ($show_feed == 0) {</php>
              <li class="lineD_btm" id="list_li_{$vo.id}">
                <div class="userPic">
                <space uid="vo.uid" >{uavatar}</space>                
                </div>
                <div class="feed_c">
                  <div class="msgCnt"><a name="weibo{$vo.id}"></a><space uid="vo.uid" >{uname}</space>{$vo.uid|getUserGroupIcon}：{$vo.content|group_weibo_format=###,$vo['gid'],true}</div>
                  <php>if( $vo['transpond_id'] ){</php>
                  <php>if($vo['expend']){</php>
                      <div class="feed_quote"> <img class="q_ico_arrow" src="__THEME__/images/zw_img.gif" />
                        <div class="q_tit"><img class="q_tit_l" src="__THEME__/images/zw_img.gif" /></div>
                        <div class="q_con"> <space uid="vo.expend.uid" class="null" >@{uname}</space> ：{$vo.expend.content|group_weibo_format=###,$vo['expend']['gid'],true} <a href="{:U('group/Group/detail',array('gid'=>$vo['expend']['gid'],'id'=>$vo['expend']['id']))}">原文转发({$vo.expend.transpond}</a>)&nbsp;|&nbsp;<a href="{:U('group/Group/detail',array('gid'=>$vo['expend']['gid'],'id'=>$vo['expend']['id']))}">原文评论({$vo.expend.comment})</a> {$vo.expend.expend} </div>
                        <div class="q_btm"><img class="q_btm_l" src="__THEME__/images/zw_img.gif" /></div>
                      </div>
                   <php>}else{</php>
                      <div class="feed_quote"> <img class="q_ico_arrow" src="__THEME__/images/zw_img.gif" />
                        <div class="q_tit"><img class="q_tit_l" src="__THEME__/images/zw_img.gif" /></div>
                        <div class="q_con">此微博已被原作者删除</div>
                        <div class="q_btm"><img class="q_btm_l" src="__THEME__/images/zw_img.gif" /></div>
                      </div>
                   <php>}</php>
                  <php>}else{</php>
                  {$vo.expend}
                  <php>}</php>
                  <div class="feed_c_btm"> 
                      <span class="right">
                        <php>if( $vo['uid'] == $mid ){</php>
                        <a href="javascript:void(0)" onclick="ui.confirm(this,'确认要删除这条微博?')" callback="weibo.deleted({$vo.id}, {$vo.gid})">删除</a>&nbsp;&nbsp;|&nbsp;&nbsp;
                        <php>}</php>
                        <a href="javascript:void(0)" onclick="weibo.transpond({$vo.id}, {$vo.gid})">转发({$vo.transpond})</a>&nbsp;&nbsp;|&nbsp;&nbsp; 
                        <a href="javascript:void(0)" onclick="weibo.share({$vo.id}, {$vo.gid})">分享</a>&nbsp;&nbsp;|&nbsp;&nbsp; 
                        <a href="javascript:void(0)" rel="comment" minid="{$vo.id}" groupid="{$vo.gid}">评论({$vo.comment})</a> 
                      </span> 
                      <cite> <a href="{:U('group/Group/detail',array('gid'=>$vo['gid'],'id'=>$vo['id']))}">{$vo.ctime|friendlyDate}</a></cite> 
                      来自 <cite><?php echo getFrom($vo['from'], $vo['from_data']);?></cite> 
                  </div>
                  <div id="comment_list_{$vo.id}" style=""></div>
                </div>
              </li>
<php>}else{</php>
            <li class="lineD_btm" id="list_li_{$vo.feed_id}">
                <!--   动态显示方式   -->
                <div class="userPic"><space uid="vo.uid">{uavatar}</space></div>
                <div class="feed_c">
                  <div class="msgCnt">{$vo.title}
                    <p>{$vo.body}</p>
                  </div>
                  <div class="feed_c_btm"> <span class="right">
                    <php>if( $vo['uid'] == $mid ){</php>
                    <a href="javascript:void(0)" onclick="ui.confirm(this,'确认要删除这条动态?')" callback="deleteMini('{$vo.feed_id}')">删除</a>&nbsp;&nbsp;
                    <php>}</php>
                    </span> <cite> {$vo.ctime|friendlyDate='normal'} </div>
                </div>
            </li>
<php>}</php>              
            </volist>
          <php>} else if (ACTION_NAME == 'search') {</php>
		  	<li>未搜索到相关的话题</li>
		  <php>}</php>
          </ul>

          <php>if ($show_feed || ACTION_NAME != 'index') {</php>
            <p class="page">{$list.html}</p>
          <php>} else {</php>
            <p class="moreFoot"><a href="javascript:void(0)" onclick="loadmore(this)">更多</a></p>
          <php>}</php>
        </div>
        <div class="c"></div>
        </div>
      </div>
  <!-- end  -->
  </div>
    <div class="c"></div>
  </div>
  </div>
  </div><!-- 右侧内容 end  -->
<script>
<php>if(ACTION_NAME=='index' && $show_feed==0){</php>
var sinceId = '{$vo.id}';
var lastId  = '<php>echo $list["data"][0]["id"]</php>';
var showfeed = '{$show_feed}';
<php>}</php>
<php>if($type=='' && ACTION_NAME=='index' && $show_feed==0){</php>
$(document).ready(function(){
//更新最新的微博数
setInterval("countNew()",120000);
});

//获取未读取的条数
function countNew(){
$.post(U('group/WeiboIndex/countnew'),{gid:gid,lastId:lastId,showfeed:showfeed},function(txt){
    if(txt.indexOf('<TSAJAX>')==0) {
        if(txt.indexOf('<HASNEW>')!=-1) {
            $('#countNew').html(txt);
        }
    }else{
        location.reload();
    }
})
}

//加载未读取的微博
function loadNew(pLastId,limit,showfeed){
$.post(U('group/WeiboIndex/loadnew'),{gid:gid,since:pLastId,limit:limit,showfeed:showfeed},function(txt){
    if(txt.indexOf('<TSAJAX>')==0){
        if(txt.indexOf('<HASNEW>')!=-1) {
            lastId = pLastId;
            $('#countNew').html('');
            $('.feed_list').prepend(txt);
        }
    }else{
        location.reload();
    }
        
})
}

//加载更多
function loadmore(o){
var type = '{$type}';
$(o).html('加载中...');
$.post(U('group/WeiboIndex/loadmore'),{gid:gid,type:type,since:sinceId,showfeed:showfeed},function(txt){
    if(txt){
        $('.feed_list').append(txt);
    }
    $(o).html('更多');    
});
}
<php>}</php>
</script>
<include file="__THEME__/footer" />